var app = new Vue({
  el: '#app',
  data: {
    // 用户IP
    userIp:'获取中',
    //搜索类别
    searchTypeIndex:0,
    searchType:[
      {
        text:'全部',
        value:'',
        placeholder:'全球治理 一带一路 宏观经济 甲骨文 群体事件',
        options:[
          {
            text:'全文',
            value:'all'
          },
          {
            text:'标题',
            value:'searchTitle'
          },
          {
            text:'作者',
            value:'authors'
          },
          {
            text:'关键词',
            value:'keyWords'
          },
          {
            text:'ISBN',
            value:'ISBN'
          }
        ]
      },
      {
        text:'图书',
        value:'tushu',
        placeholder:'图片搜索关键词...',
        options:[
          {
            text:'全文',
            value:'all'
          },
          {
            text:'标题',
            value:'searchTitle'
          },
          {
            text:'作者',
            value:'authors'
          }
        ]
      },
      {
        text:'辞条',
        value:'citiao',
        placeholder:'辞条搜索关键词...',
        options:[
          {
            text:'全文',
            value:'all'
          },
          {
            text:'标题',
            value:'searchTitle'
          }
        ]
      },
      {
        text:'视频',
        value:'shipin',
        placeholder:'视频搜索关键词...',
        options:[
          {
            text:'全文',
            value:'all'
          },
          {
            text:'标题',
            value:'searchTitle'
          },
          {
            text:'作者',
            value:'authors'
          }
        ]
      },
      {
        text:'专家',
        value:'zuozhe',
        placeholder:'专家搜索关键词...',
        options:[
          {
            text:'全文',
            value:'all'
          },
          {
            text:'作者',
            value:'authors'
          }
        ]
      },
      {
        text:'报纸',
        value:'baozhi',
        placeholder:'报纸搜索关键词...',
        options:[
          {
            text:'全文',
            value:'all'
          },
          {
            text:'作者',
            value:'authors'
          }
        ]
      },
      {
        text:'期刊',
        value:'qikan',
        placeholder:'期刊搜索关键词...',
        options:[
          {
            text:'全文',
            value:'all'
          },
          {
            text:'标题',
            value:'searchTitle'
          }
        ]
      }
    ]
  },
  //生命周期-创建
  created: function () {
    this.getIp();//获取IP
  },
  //生命周期-挂载后
  mounted:function(){
    this.init(); //页面基本JS效果
  },
  methods: {
    //页面基本JS效果
    init: function () {
      //幻灯片
      $(".index-banner").slide({mainCell:".pic",titCell:".num",autoPage:"<li></li>",autoPlay:true,effect:"fold"});
      //资源快讯滚动
      $(".index-box-three .gund").slide({mainCell:"ul",autoPlay:true,effect:"topMarquee",vis:4,interTime:50,trigger:"click"});
      //tab切换
      $(".index-js-switch").slide({mainCell:".xun",titCell:".tab li",autoPlay:true,trigger:"click",delayTime:0});
      // 专家作者库
      $(".index-expert-five").slide({mainCell:"ul",autoPage:true,effect:"left",autoPlay:true,vis:5,pnLoop:false});
    },
    //搜索类别点击
    searchTypeChange: function (e) {
      this.searchTypeIndex=e;
    },
    // 获取IP
    getIp: function () {
      var _that=this;
      axios.get('https://api.ipify.org/?format=json&callback=')
      .then(function (res) {
        if(res.status==200){
          _that.userIp=res.data.ip;
        }
      })
      .catch(function (error) {
        $('.index-welcome').remove();
        console.log(error);
      });
    }
  }
})